<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qtsoap.cpp -->
<head>
  <title>QtSoapHttpTransport Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
</tr></table><h1 class="title">QtSoapHttpTransport Class Reference</h1>
<p>The QtSoapHttpTransport class provides a mechanism for transporting SOAP messages to and from other hosts using the HTTP protocol. <a href="#details">More...</a></p>
<pre> #include &lt;QtSoapHttpTransport&gt;</pre><p>Inherits <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a>.</p>
<ul>
<li><a href="qtsoaphttptransport-members.html">List of all members, including inherited members</a></li>
<li><a href="qtsoaphttptransport-obsolete.html">Obsolete members</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#QtSoapHttpTransport">QtSoapHttpTransport</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#dtor.QtSoapHttpTransport">~QtSoapHttpTransport</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const QtSoapMessage &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#getResponse">getResponse</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QNetworkAccessManager * </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#networkAccessManager">networkAccessManager</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QNetworkReply * </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#networkReply">networkReply</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#setAction">setAction</a></b> ( const QString &amp; <i>action</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#setHost">setHost</a></b> ( const QString &amp; <i>host</i>, bool <i>useSecureHTTP</i> = false, int <i>port</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#submitRequest">submitRequest</a></b> ( QtSoapMessage &amp; <i>request</i>, const QString &amp; <i>path</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-functions">QObject</a></li>
</ul>
<hr />
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#responseReady">responseReady</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#responseReady-2">responseReady</a></b> ( const QtSoapMessage &amp; <i>response</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 signal inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>1 property inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#properties">QObject</a></li>
<li><div class="fn"></div>1 public slot inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-slots">QObject</a></li>
<li><div class="fn"></div>1 public type inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-variables">QObject</a></li>
<li><div class="fn"></div>4 static public members inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"></div>2 protected variables inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QtSoapHttpTransport class provides a mechanism for transporting SOAP messages to and from other hosts using the HTTP protocol.</p>
<p>Use this class to submit SOAP messages to a web service. Set the hostname of the SOAP server with <a href="qtsoaphttptransport.html#setHost">setHost</a>(). Some servers also require the SOAPAction header to be set, and you can do this with <a href="qtsoaphttptransport.html#setAction">setAction</a>(). Next, submit the request with <a href="qtsoaphttptransport.html#submitRequest">submitRequest</a>(), passing the message to submit together with the path that you want to submit the message to. The <a href="qtsoaphttptransport.html#responseReady">responseReady</a>() signal is emitted when a response has been received. Call <a href="qtsoaphttptransport.html#getResponse">getResponse</a>() to get the reponse from the service.</p>
<p>QtSoapHttpTransport usage example: If a SOAP weather service was running on the host weather.example.com, the following code might be used to find the temperature in any given city:</p>
<pre> void WeatherFetcher::findTemperature(const QString &amp;city)
 {
     QtSoapMessage message;
     message.setMethod(&quot;getTemperature&quot;, &quot;http:<span class="comment">//weather.example.com/temperature&quot;);</span>
     message.setMethodArgument(&quot;city&quot;, &quot;&quot;, city);

     <span class="comment">// transport is a private member of WeatherFetcher, of type QtSoapHttpTransport</span>
     transport.setHost(&quot;www.example.com&quot;);
     connect(&amp;transport, SIGNAL(responseReady()), SLOT(readResponse()));

     transport.submitRequest(message, &quot;/weatherfetcher/fetch.asp&quot;);
 }</pre>
<p>This is an example implementation of the readResponse() slot in the WeatherFetcher class:</p>
<pre> void WeatherFetcher::readResponse()
 {
     const QtSoapMessage &amp;response = transport.getResponse();
     if (response.isFault()) {
         cout &lt;&lt; response.faultString().toString().toLatin1().constData() &lt;&lt; endl;
         return;
     }

     const QtSoapType &amp;returnValue = response.returnValue();
     if (returnValue[&quot;temperature&quot;].isValid()) {
     cout &lt;&lt; &quot;The current temperature is &quot;
          &lt;&lt; returnValue[&quot;temperature&quot;].toString().toLatin1().constData()
          &lt;&lt; &quot; degrees Celcius.&quot; &lt;&lt; endl;
 }</pre>
<p>See also <a href="qtsoapmessage.html">QtSoapMessage</a> and <a href="qtsoaptype.html">QtSoapType</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QtSoapHttpTransport"></a>QtSoapHttpTransport::QtSoapHttpTransport ( <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qtsoaphttptransport.html">QtSoapHttpTransport</a> object. Passes <i>parent</i> to <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a>'s constructor.</p>
<h3 class="fn"><a name="dtor.QtSoapHttpTransport"></a>QtSoapHttpTransport::~QtSoapHttpTransport ()</h3>
<p>Destructs a <a href="qtsoaphttptransport.html">QtSoapHttpTransport</a>.</p>
<h3 class="fn"><a name="getResponse"></a>const <a href="qtsoapmessage.html">QtSoapMessage</a> &amp; QtSoapHttpTransport::getResponse () const</h3>
<p>Returns the most recently received response SOAP message. This message could be a Fault message, so it is wise to check using <a href="qtsoapmessage.html#isFault">QtSoapMessage::isFault</a>() before processing the response.</p>
<h3 class="fn"><a name="networkAccessManager"></a><a href="http://qt.nokia.com/doc/4.6/qnetworkaccessmanager.html">QNetworkAccessManager</a> * QtSoapHttpTransport::networkAccessManager ()</h3>
<p>Returns a pointer to the <a href="http://qt.nokia.com/doc/4.6/qnetworkaccessmanager.html">QNetworkAccessManager</a> object used by this transport. This is useful if the application needs to connect to its signals, or set or read its cookie jar, etc.</p>
<h3 class="fn"><a name="networkReply"></a><a href="http://qt.nokia.com/doc/4.6/qnetworkreply.html">QNetworkReply</a> * QtSoapHttpTransport::networkReply ()</h3>
<p>Returns a pointer to the <a href="http://qt.nokia.com/doc/4.6/qnetworkreply.html">QNetworkReply</a> object of the current (or last) request, or 0 if no such object is currently available.</p>
<p>This is useful if the application needs to access the raw header data etc.</p>
<h3 class="fn"><a name="responseReady"></a>void QtSoapHttpTransport::responseReady ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when a SOAP response is received from a remote peer.</p>
<p>See also <a href="qtsoaphttptransport.html#getResponse">getResponse</a>().</p>
<h3 class="fn"><a name="responseReady-2"></a>void QtSoapHttpTransport::responseReady ( const <a href="qtsoapmessage.html">QtSoapMessage</a> &amp; <i>response</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when a SOAP response is received from a remote peer. The received response is available in <i>response</i>. This signal is emitted in tandem with the argument-less <a href="qtsoaphttptransport.html#responseReady">responseReady</a>() signal.</p>
<p>See also <a href="qtsoaphttptransport.html#responseReady">responseReady</a>().</p>
<h3 class="fn"><a name="setAction"></a>void QtSoapHttpTransport::setAction ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>action</i> )</h3>
<p>Sets the HTTP header SOAPAction to <i>action</i>.</p>
<h3 class="fn"><a name="setHost"></a>void QtSoapHttpTransport::setHost ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>host</i>, bool <i>useSecureHTTP</i> = false, int <i>port</i> = 0 )</h3>
<p>Sets the <i>host</i> this transport should connect to. The transport mode will be HTTP, unless <i>useSecureHTTP</i> is set, in which case it will be HTTPS. This transport will connect to the well-known ports by default (80 for HTTP, 443 for HTTPS), unless a different, non-zero port is specified in <i>port</i>.</p>
<h3 class="fn"><a name="submitRequest"></a>void QtSoapHttpTransport::submitRequest ( <a href="qtsoapmessage.html">QtSoapMessage</a> &amp; <i>request</i>, const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>path</i> )</h3>
<p>Submits the SOAP message <i>request</i> to the path <i>path</i> on the HTTP server set using <a href="qtsoaphttptransport.html#setHost">setHost</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
</tr></table></div></address></body>
</html>
